//: Playground - noun: a place where people can play

import UIKit

var str = "Hello, playground"

class Person: NSObject {
    // 属性监听器， willSet/didSet
    var name: String? {
        willSet {
            print("======willSet")
            print("<\(self.name)==>\(newValue)>")
        }
        
        didSet {
            print("======didSet")
            print("<\(oldValue)==>\(self.name)>")
        }
    }
}

let p = Person();
p.name = "xxx";

p.name = "AAA";

